package com.libbase

inline fun<reified T> cast(obj: Any?): T? {
    return if (obj is T) {
        obj
    } else {
        null
    }
}

@Suppress("UNCHECKED_CAST")
inline fun<reified T> castList(obj: Any?): List<T>? {
    return if (obj is List<*>) {
        return if (obj.all { it is T })
            obj as List<T>
        else
            null
    } else {
        null
    }
}